package com.liqi.frame.comm.base;

import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.Map;

/**
 * 对象基础类
 * @author liqi on 2017/11/24.
 * liqiwork@qq.com
 */
@Data
@ApiModel(value = "基类对象", description = "所有数据对象都要继承此类")
public abstract class BaseEntity<T> extends Model implements Serializable {

    private static final long serialVersionUID = 7992426539947177065L;
    @ApiModelProperty(value = "主键")
    private String id;
    /**
     * 序号
     */
//    private Float orderId;
    /**
     * 创建者
     */
//    private String createBy;
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    /**
     * 修改者
     */
//    private String updateBy;

    @ApiModelProperty(value = "修改时间")
    private Date updateTime;
    @ApiModelProperty(value = "删除标记")
    private Integer delFlag;

//    public BaseEntity() {
//        this.setId((String) IdUtil.getId());
//        this.setOrderId(new Float(1));
//
//    }

    /**
     * 附带参数(页面传参示例：name="params[endTime]"), 页面引用示例：name="params.endTime"
     */
    @ApiModelProperty(hidden=true)
    private Map<String, Object> params;

    /**
     * 清空所有参数
     */
    public void clearParams() {
        if (null != this.params) {
            this.params.clear();
            this.params = null;
        }
    }

//    public Map<String, Object> getParams() {
//        if (params == null)
//        {
//            params = new HashMap<>();
//        }
//        return params;
//    }
//
//    public void setParams(Map<String, Object> params) {
//        this.params = params;
//    }
}
